package com.rxtxdemo.rxtxdemo.demo;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.Collections;
import java.util.List;
import java.util.Vector;

/**
 * 指令执行分发列表
 */
@Slf4j
public class OrderList {

    //初始化指令列表
    private static Vector<Order> v = new Vector<Order>();

    public void init() {
        for (int i = 0; i < 1; i++) {
            Order o = new Order();
            o.setComName("COM8");
//            o.setOrderStr("order--" + i);
            // FC FC FC 01 00 05 10 01 80 00 00 66 4D
            // FC FC FC 00 01 07 90 01 00 00 00 00 00 19 F5
            String s = StrUtil.cleanBlank("FC FC FC 01 00 05 10 01 40 18 00 4B E1");
            o.setOrderStr(s);
            v.add(o);
        }
    }

    public List setV() {
        return Collections.list(v.elements());
    }

    //打印指令列表
    public void getV() {
        log.info("输出指令列表：[{}]", v);
    }
}
